package com.roncoo.student.stu.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.roncoo.student.stu.entity.User;
import com.roncoo.student.stu.service.IUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jl
 * @since 2021-03-29
 */
@RestController
@RequestMapping("/stu/user")
public class UserController {
    @Resource
    private IUserService iUserService;

    //@ApiOperation("前台上传阿里云图片，返回路径 ")
    @PostMapping("getImgPath")
    public String getpath( MultipartFile file){
        String path=iUserService.getPath(file);
        return path;
    }

    /*
     * 查询学员信息
     * */
    @PostMapping("/findAll")
    public Page findAll(User user, Page page){
        System.out.println(user);

        return   iUserService.findAll(user, page);
    }

    /*
     * 修改学员信息
     * */

    @PostMapping("/updStudent")
    public Boolean updStudent(User user){
        System.out.println(user+"==============");
        return iUserService.updateById(user);

    }

    @GetMapping("/slectAll")
    public User slectAll(Integer uid){
        return  iUserService.getById(uid);
    }


}

